<template>
  <div class="left-nav">
    <div class="side-nav">
      <div
        v-for="(item, index) in navOptions"
        :key="index"
        class="side-btn"
        :class="{ active: activeItem === index }"
        @click="changeItem(index)"
      >
        <div>{{ item.title }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { navOptions } from "./config";
export default {
  name: "LeftNav",
  props: {
    activeItem: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      navOptions,
    };
  },
  methods: {
    changeItem(index) {
      this.$emit("update:activeItem", index);
    },
  },
};
</script>

<style lang="less" scoped>
.dark-theme .left-nav {
  .side-btn {
    color: #0a7f63;
  }
}

.left-nav {
  width: 155px;
  height: 100%;
  padding: 12px 0 0;
  box-sizing: border-box;
  .side-nav {
    height: 100%;
    padding: 30px 15px;
    box-sizing: border-box;
    border-right: 1px solid var(--border-color);
    .side-btn {
      font-size: 18px;
      font-weight: 400;
      line-height: 26px;
      color: var(--color-nav-text);
      text-align: right;
      cursor: pointer;
      &.active,
      &:hover {
        font-weight: 700;
      }
    }
    .side-btn + .side-btn {
      margin-top: 24px;
    }
  }
}
</style>
